import 'package:cat_eye/config/color_config.dart';
import 'package:cat_eye/config/string_config.dart';
import 'package:cat_eye/util/loading_state_widget_util.dart';
import 'package:cat_eye/util/util.dart';
import 'package:flutter/material.dart';

import 'home_body_page_widget.dart';

/*
* @Package: home_page
* @ClassName: home
* @Author: szj
* @CreateDate: 7/28/21 1:19 PM
* 首页页面
*/
class HomePageWidget extends StatefulWidget {
  const HomePageWidget({Key key}) : super(key: key);

  @override
  _HomePageWidgetState createState() => _HomePageWidgetState();
}

/*
 * AutomaticKeepAliveClientMixin 作用:
 *  切换tab保留tab的状态，避免initState()重复调用
 *  1. 比如重写wantKeepAlive 并且返回true
 *  2. build 必须返回super
 */
class _HomePageWidgetState extends State<HomePageWidget>
    with AutomaticKeepAliveClientMixin {
  @override
  Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
      appBar: appBar(StringConfig.HOME,backgroundColor: ColorConfig.themeColor),
      body: HomeBodyPageWidget(),
    );
  }

  @override
  bool get wantKeepAlive => true;
}
